<?php

namespace App\Service\SiteLocation;

use App\Models\Common\ConfigModel;
use App\Service\BaseService;

class SiteLocationLogicService extends BaseService
{
    /**
     * 通过战区ID获得战区通知机器人
     */
    public static function getRobotByRegionManageId(int $regionManageId): array
    {
        // 获得所有机器人
        $robotConfig = ConfigModel::getValueNewJson('siteLocation', 'regionDivide', 3600);

        if ($regionManageId == 0) {
            return $robotConfig;
        }

        $robot = [];
        foreach ($robotConfig as $robotItem) {
            if ($robotItem['regionManageId'] == $regionManageId) {
                $robot = $robotItem['robot'];
            }
        }

        return $robot;
    }
}